import request from '@/utils/request'

// 查询菜单列表
export function treeMenuList(data) {
  return request({
    url: '/adminapi/Menu/TreeMenuList',
    method: 'post',
    data: data
  })
}
// 查询菜单列表
export function listMenuById(menuId) {
  return request({
    url: '/adminapi/Menu/list/' + menuId,
    method: 'get'
  })
}
// 查询菜单详细
export function getMenuInfo(data) {
  return request({
    url: '/adminapi/Menu/GetMenuInfo',
    method: 'post',
    data:data
  })
}

// 查询菜单下拉树结构
export function treeselect() {
  return request({
    url: '/adminapi/Menu/treeSelect',
    method: 'get'
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId) {
  return request({
    url: '/adminapi/Menu/roleMenuTreeselect/' + roleId,
    method: 'get'
  })
}

// 新增菜单
export const menuAdd = (data) => {
  return request({
    url: '/adminapi/Menu/MenuAdd',
    method: 'post',
    data: data
  })
}

// 修改菜单
export function menuEdit(data) {
  return request({
    url: '/adminapi/Menu/MenuEdit',
    method: 'post',
    data: data
  })
}

// 删除菜单
export function deleteMenuById(data) {
  return request({
    url: '/adminapi/Menu/DeleteMenuById',
    method: 'post',
    data:data
  })
}

// 删除菜单
export function deleteAllMenuById(data) {
  return request({
    url: '/adminapi/Menu/DeleteAllMenuById',
    method: 'post',
    data:data
  })
}

//排序
export function changeMenuSort(data) {
  return request({
    url: '/adminapi/Menu/ChangeSort',
    method: 'GET',
    params: data
  })
}

// 获取路由
export const getRouterInfo = (query) => {
  return request({
    url: '/authapi/Router/GetRouterInfo',
    method: 'get',
    params: query
  })
}
